package com.example.command.Impi;

import com.example.command.Command;
import com.example.command.Light;

public class LightOffCommandImpi implements Command {
    private Light light;
    private boolean on = true;

    public LightOffCommandImpi(Light light) {
        this.light = light;
    }

    @Override
    public void execute() {
        if (on) {
            light.turnOff();
            on = true;
        }
    }

    @Override
    public void undo() {
        if (!on) {
            light.turnOn();
            on = false;
        }
    }
}
